local sk__hemou_active = fk.CreateSkill {

  name = "sk__hemou&",

  tags = {},

}

local SrYueyingMapper = function(id)
  local suit = Fk:getCardById(id, true).suit
  local mapper = {
    [Card.Spade] = "duel",
    [Card.Club] = "collateral",
    [Card.Heart] = "snatch",
    [Card.Diamond] = "fire_attack",
    [Card.NoSuit] = "",
  }
  return mapper[suit]
end

sk__hemou_active:addEffect("viewas", {
  name = "sk__hemou&",
  anim_type = "special",
  prompt = function(self, player, selected, selected_cards)
    return "#sk__hemou:::" .. Fk:getCardById(player:getMark("sk__hemou-phase"), true):getSuitString(true) .. ":" ..
        SrYueyingMapper(player:getMark("sk__hemou-phase"))
  end,
  card_filter = function(self, player, to_select, selected)
    return #selected == 0 and
        Fk:getCardById(to_select).suit == Fk:getCardById(player:getMark("sk__hemou-phase"), true).suit and
        Fk:currentRoom():getCardArea(to_select) ~= Card.PlayerEquip
  end,
  view_as = function(self, player, cards)
    if #cards ~= 1 then return end
    local card = Fk:cloneCard(SrYueyingMapper(player:getMark("sk__hemou-phase")))
    card.skillName = "sk__hemou"
    card:addSubcards(cards)
    return card
  end,
  enabled_at_play = function(self, player)
    return player:usedSkillTimes(sk__hemou_active.name, Player.HistoryPhase) == 0 and
    player:getMark("sk__hemou-phase") ~= 0
  end,
  enabled_at_response = Util.FalseFunc,
})

return sk__hemou_active
